package com.oauth.logging;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Logger class used to abstract different logging providers . Currently it is
 * using java.util.Logging.
 * 
 * @author asanthan
 * 
 */
public class JDKLogger implements RapwavesLogger {
	private Logger mLogger;

	private JDKLogger(Logger pLogger) {
		mLogger = pLogger;
	}

	public JDKLogger getLogger(String pName) {
		return new JDKLogger(Logger.getLogger(pName));
	}

	public <T> JDKLogger getLogger(Class<T> pClass) {
		return getLogger(pClass.getName());
	}

	public void info(String pMessage) {
		mLogger.info(pMessage);
	}

	public void debug(String pMessage) {
		mLogger.fine(pMessage);
	}

	public void error(String pMessage) {
		mLogger.log(Level.SEVERE, pMessage);
	}

	public void error(String pMessage, Throwable pThrown) {
		mLogger.log(Level.SEVERE, pMessage, pThrown);
	}

	public void entering(String pSourceClass, String pSourceMethod) {
		mLogger.entering(pSourceClass, pSourceMethod);
	}

	public void throwing(String pSourceClass, String pSourceMethod, Throwable pThrown) {
		mLogger.throwing(pSourceClass, pSourceMethod, pThrown);
	}
}
